import React, {useEffect, useState} from 'react'
import BatchUpload from '@/components/BatchUpload'
import {getExcl, postExcl, getData} from '@/service/merchantCenter/clue'

function ExportExcl(props: any) {
	const {info, sunchange} = props
	const [importDriverId, setImportDriverId] = useState(false) // 导入滴滴非滴滴司机ID
	useEffect(() => {
		setImportDriverId(info)
	}, [info])
	const childCange = (value: any) => {
		if (sunchange) {
			sunchange(value)
		}
	}
	// const [fileObj, setFileObj] = useState<any>()
	const column = [
		{
			title: '名称',
			dataIndex: 'name',
			align: 'center',
			key: 'name',
			width: 200,
		},
		{
			title: '方案生效时间',
			dataIndex: 'startDate',
			align: 'center',
			key: 'startDate',
			width: 100,
		},
		{
			title: '方案失效时间',
			dataIndex: 'endDate',
			align: 'center',
			key: 'endDate',
			width: 100,
		},
		{
			title: '主体',
			dataIndex: 'subjectName',
			align: 'center',
			key: 'subjectName',
			width: 100,
		},
		{
			title: '城市',
			dataIndex: 'cityName',
			align: 'center',
			key: 'cityName',
			width: 200,
		},
		{
			title: '所属公司',
			dataIndex: 'orgName',
			align: 'center',
			key: 'orgName',
			width: 200,
		},
		{
			title: '品牌/车型/车系',
			dataIndex: 'brand',
			align: 'center',
			key: 'brand',
			width: 200,
		},
		{
			title: '租赁类型',
			dataIndex: 'orderTypeStr',
			align: 'center',
			key: 'orderTypeStr',
			width: 200,
		},
		{
			title: '租期',
			dataIndex: 'leaseTerm',
			align: 'center',
			key: 'leaseTerm',
			width: 200,
		},
		{
			title: 'AMC一级渠道类型',
			dataIndex: 'channelTypeOneStr',
			align: 'center',
			key: 'channelTypeOneStr',
			width: 200,
		},
		{
			title: 'AMC二级渠道类型',
			dataIndex: 'channelTypeTwoStr',
			align: 'center',
			key: 'channelTypeTwoStr',
			width: 200,
		},
		{
			title: '阶梯计算方式',
			dataIndex: 'stepCalculationStr',
			align: 'center',
			key: 'stepCalculationStr',
			width: 200,
		},
		{
			title: '结算时是否需要求在租',
			dataIndex: 'isRenting',
			align: 'center',
			key: 'isRenting',
			width: 200,
		},
		{
			title: '稳定租赁起要求天数',
			dataIndex: 'stableLeasing',
			align: 'center',
			key: 'stableLeasing',
			width: 200,
		},
		{
			title: '新司机下单前要求间隔时间',
			dataIndex: 'placeOrder',
			align: 'center',
			key: 'placeOrder',
			width: 200,
		},
		{
			title: '阶梯奖励提档方式',
			dataIndex: 'proMethodStr',
			align: 'center',
			key: 'proMethodStr',
			width: 200,
		},
		{
			title: '错误原因',
			dataIndex: 'reason',
			align: 'center',
			key: 'reason',
			width: 200,
			fixed: 'right',
		},
	]
	return (
		<BatchUpload
			isModalOpen={importDriverId}
			setIsModalOpen={setImportDriverId}
			importData={getExcl} // 导入接口
			onTableList={getData} // 获取列表数据-失败
			getListData={childCange} // 获取列表数据-成功
			columns={column}
			sourceId={41}
			templateType="渠道规则导入模板"
			uploadFileUrl={postExcl} // 文件上传接口
			title="导入渠道拉新奖励规则"
			width={800}
			// childCange={childCange}
		/>
	)
}

export default ExportExcl
